package com.heima.article.controller.v1;

import com.heima.article.service.impl.ApArticleServiceImpl;
import com.heima.common.constants.ArticleConstants;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.common.dtos.ResponseResult;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ly
 * @Date: 2021/08/22/14:15
 * @Description:
 */
@RestController
@RequestMapping("/api/v1/article")
public class ArticleHomeController {

    @Autowired
    private ApArticleServiceImpl apArticleService;


    /*
    *
    * 首页
    *
    * */
    @PostMapping("load")
    public ResponseResult  load(@RequestBody ArticleHomeDto dto){
        return apArticleService.load(dto, ArticleConstants.LOADTYPE_LOAD_MORE);
    }




    /*
     *
     * 加载更多页
     *
     * */
    @PostMapping("loadmore")
    public ResponseResult  loadmore(@RequestBody ArticleHomeDto dto){
        return apArticleService.load(dto,ArticleConstants.LOADTYPE_LOAD_MORE);
    }





    /*
     *
     * 加载最新页
     *
     * */
    @PostMapping("loadnew")
    public ResponseResult  loadnew(@RequestBody ArticleHomeDto dto){
        return apArticleService.load(dto,ArticleConstants.LOADTYPE_LOAD_NEW);
    }







}
